package com.example.demo03_mvm.adapter;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.databinding.DataBindingUtil;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.example.demo03_mvm.databinding.ItemGoodslistBinding;
import com.example.demo03_mvm.model.GoodsEntity;

import java.util.List;

public class GoodsListAdapter extends BaseQuickAdapter<GoodsEntity.DataBean, BaseViewHolder> {
    public GoodsListAdapter(int layoutResId, @Nullable List<GoodsEntity.DataBean> data) {
        super(layoutResId, data);
    }

    @Override
    public void onBindViewHolder(@NonNull BaseViewHolder holder, int position) {
        DataBindingUtil.bind(holder.itemView);
        super.onBindViewHolder(holder, position);
    }

    @Override
    protected void convert(@NonNull BaseViewHolder baseViewHolder, GoodsEntity.DataBean dataBean) {
        ItemGoodslistBinding binding=(ItemGoodslistBinding) baseViewHolder.getBinding();
        binding.setGoods(dataBean);
    }
}
